package com.itheima.list;

import com.itheima.domain.Student;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/*
	需求 使用Collection  存储并遍历学生
 */
public class Test01 {

    public static void main(String[] args) {

        List<Student> list= new ArrayList<>();

        Student lu = new Student("鹿晗", 28);
       // Student lu2 = new Student("鹿晗", 28);
        Student guan = new Student("关晓彤", 28);
        Student zhang = new Student("张艺兴", 28);
        Student wu = new Student("吴亦凡", 28);
        list.add(lu);
        list.add(lu);
        list.add(guan);
        list.add(zhang);
        list.add(wu);

     /*   Iterator<Student> iterator = list.iterator();
        while (iterator.hasNext()){
            Student next = iterator.next();
            System.out.println(next);
        }
*/
        for (Student student : list) {
            System.out.println(student);
        }

        list.forEach(t-> System.out.println(t));
    }
}
